﻿package mortal.game.view.copy.wine.renderer
{
    import com.greensock.layout.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.copy.wine.data.*;

    public class WineDonateRankCellRenderer extends GCellRenderer
    {
        private var _rank:GTextFiled;
        private var _roleName:GTextFiled;
        private var _rolePosition:GTextFiled;
        private var _fundsNum:GTextFiled;
        private var _rankData:WineDonateRankData;

        public function WineDonateRankCellRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._rank = UIFactory.gTextField("", 24, 4, 30, 20, this, GlobalStyle.textFormatBai);
            var _loc_1:* = GlobalStyle.textFormatBai;
            _loc_1.align = AlignMode.CENTER;
            this._roleName = UIFactory.gTextField("", 62, 4, 95, 20, this, _loc_1);
            this._rolePosition = UIFactory.gTextField("", 186 - 4, 4, 54, 20, this, GlobalStyle.textFormatBai);
            this._fundsNum = UIFactory.gTextField("", 256 - 12, 4, 50, 20, this, _loc_1);
            this.pushUIToDisposeVec(UIFactory.bg(0, 26, 306, 2, this, ImagesConst.SplitLine));
            return;
        }// end function

        override protected function initSkin() : void
        {
            var _loc_1:* = new GBitmap();
            var _loc_2:* = UIFactory.bg(0, 0, 306, 28, null, ImagesConst.RegionTitleBg);
            this.setStyle("downSkin", _loc_2);
            this.setStyle("overSkin", _loc_2);
            this.setStyle("upSkin", _loc_1);
            this.setStyle("selectedDownSkin", _loc_2);
            this.setStyle("selectedOverSkin", _loc_2);
            this.setStyle("selectedUpSkin", _loc_2);
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._rankData = param1 as WineDonateRankData;
            if (this._rankData)
            {
                this._rank.text = this._rankData.rank + "";
                this._roleName.text = this._rankData.roleName;
                this._rolePosition.text = this._rankData.rolePosition;
                this._fundsNum.text = this._rankData.fundsNum + "";
                if (this._rankData.rank == 1)
                {
                    this._rank.textColor = GlobalStyle.colorChenUint;
                    this._rolePosition.textColor = GlobalStyle.colorChenUint;
                }
                if (this._rankData.rank == 2)
                {
                    this._rank.textColor = GlobalStyle.colorFenHongUint;
                    this._rolePosition.textColor = GlobalStyle.colorFenHongUint;
                }
                if (this._rankData.rank == 3)
                {
                    this._rank.textColor = GlobalStyle.colorLanUint;
                    this._rolePosition.textColor = GlobalStyle.colorLanUint;
                }
            }
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl();
            this._rank.dispose();
            this._roleName.dispose();
            this._rolePosition.dispose();
            this._fundsNum.dispose();
            this._rank = null;
            this._roleName = null;
            this._rolePosition = null;
            this._fundsNum = null;
            this._rankData = null;
            return;
        }// end function

    }
}
